Skip to content

Add --blacklist/--whitelist to mxqsub, add mxset #82

Closed
wants to merge 18 commits into from

Conversation

donald
Copy link
Contributor

@donald donald commented Apr 14, 2020

Add "whitelisted-servers" on top of "disabled servers"

@donald
Copy link
Contributor Author

donald commented Apr 14, 2020

Detected some unbalance between "disabled-servers" and "whitelisted-servers"

blacklisted? enabled? hosts .vs. servers?

Also it became quit long:

mxqset --update-whitelisted-servers=rechnerzumrechnenvonrechenaufgaben

Suggestions?

@donald donald mentioned this pull request Apr 14, 2020
@arndt
Copy link
Contributor

arndt commented Apr 14, 2020

  • you could spare the update, since the mxqset some expresses that there will be a change:
mxqset --whitelisted-servers=rechnerzumrechnenvonrechenaufgaben
  • I would probably opt for enable/disable

@wwwutz
Copy link
Contributor

wwwutz commented Apr 14, 2020

I would probably opt for enable/disable

+=1

@donald
Copy link
Contributor Author

donald commented Apr 14, 2020

* you could spare the `update`, since the `mxqset` some expresses that there will be a change:

Well, but currently we have "--whitelisted-servers=" and "--update-whitelisted-servers" for mxqset with different meanings. The first option replaces the list, while the second option adds or removes from the list.

mxqset group 123 --whitelisted-servers="aaa bbb"   # set to "aaa", "bbb"
mxqset group 123 --update-whitelisted-servers="ccc"   # add "ccc" now set to "aaa", "bbb", "ccc"
mxqset group 123 --update-whitelisted-servers="-bbb"   # remove "bbb" now set to "aaa", "ccc"
mxqset group 123 --whitelisted-servers=   ## reset to empty

I think the feature to add or remove hosts is useful. But there also needs to be a way to clear the list. How could this be done with one option only?

mxqset --whitelisted-servers=rechnerzumrechnenvonrechenaufgaben

Would this remove all other whitelisted servers from the group?

* I would probably opt for enable/disable

for whitelist/blacklist or to add/remove from one of the lists?

Perhaps use "+" prefix (additional to "-" prefix for deltas) ?

What about

mxqset group 123 --whitelist "host1 host2"   # whitelist host1 and host2
mxqset group 123 --whitelist "+host3 - host2"  # add host3, remote host2
mxqset group 123 --whitelist ""     # reset to empty list
mxqset group 123 --blacklist "host1 host2"     # same for blacklist

But what would be the result of "+host1 +host2 host3 host4"` ? Would the addition of host1 and host2 be reset by the plain "host3" . And if "host3" removed host1 and host2, why didn't "host4" remove "host3" ?

Maybe prefix the whole string with "+" or "-" for deltas?

--whitelist="host 1 host2"
--whitelist=+"host 1 host2"
--whitelist=-"host 1 host2"

Maybe this would be even more convenient if you put an expression $(hostconfig --list whatever)into the string as you don't need to add "-" or "+" to each host.

@arndt
Copy link
Contributor

arndt commented Apr 14, 2020

oh - wow - this gets philosophical - I would say:

  1. --enable "" - clears the"whitelist"

  2. --enable "host1 host2" - sets the list to host1 and host2

  3. --enable "+host1 +host2" - adds these host to the list

  4. --enable "-host1" - removes the host from the list, if it is there

  5. the rules 3. and 4 can be mixed as in --enable "+h1 -h3"

  6. mixing rule 2 with rules 3/4 is discouraged. If the user insists, the list is cleared, then all host without prefix and with + prefix are added. Then the hosts with - prefix are removed, i.e. rules 2, 3 and 4 are executed in turn on the respective sublists. E.g. --enable "-h2 h4 +h6 -h6" would result in the list h4.

@donald
Copy link
Contributor Author

donald commented Apr 15, 2020

Okay, I use that with a slight change: '+' and '-' (update) have same priority and are processed left to right. Doesn't make a difference with your example, but "-x +x a" would result in "a x" instead of "a".

@donald
Copy link
Contributor Author

donald commented Apr 15, 2020

I don't like --enable and --disable for whitelist and blacklist, because I'd expect that "enable" and "disable" revert each other. Lets settle for '--whitelist' and '--blacklist'.

@arndt
Copy link
Contributor

arndt commented Apr 15, 2020

Ok - good - just something what cam to my mind:

--enable "" 

would clear the whitelist. Does this mean that this group will not run until I put something onto the white list, or does a missing whitelist mean "all"?

@arndt
Copy link
Contributor

arndt commented Apr 15, 2020

I don't like --enable and --disable for whitelist and blacklist, because I'd expect that "enable" and "disable" revert each other. Lets settle for '--whitelist' and '--blacklist'.

mmh - I don't like this white/black philosophy

@donald
Copy link
Contributor Author

donald commented Apr 15, 2020

--enable ""
would clear the whitelist. Does this mean that this group will not run until I put something onto the white list, or does a missing whitelist mean "all"?

Oh, gosh, I need to implement this with special code

Yes, an existing whitelist means only the servers on the whitelist, a misisng whitelist means all servers. We might change that to "all normal server" later, so that we can put "special" servers into the cluster (e.g. for development or unstable hardware) which only take jobs, when explicitly requested by whitelisted.

@donald
Copy link
Contributor Author

donald commented Apr 15, 2020

mmh - I don't like this white/black philosophy

Is this a joke or serious? I hope this remark has nothing to do with skin color?

@arndt
Copy link
Contributor

arndt commented Apr 15, 2020

mmh - I don't like this white/black philosophy

Is this a joke or serious? I hope this remark has nothing to do with skin color?

I also thought that I would overreact a bit here. But at least the word "blacklist" was used the first time around 1639 in the UK wiki. Around the same time the British slave trade started. wiki. So I think there is a connection.

But you may use these words - now that I have in writing that I raised this point.

Avoid unneeded warning when scanning JOB_TMPDIR_MNTDIR for possible
leftover job mounts. The parent directory of JOB_TMPDIR_MNTDIR is
created when the first job with the --tmpdir feature is started. So
it won't exist in a new server.

This cleanup path is only used in the exceptional case that the usual
cleanup path (via job_has_finished) didn't succeed, e.g. when mxqd was
killed. The cleanup is not essential for the currently running server.
Add function attribute ((unusged)) to avoid a compiler warning when the
static inline function defined in the header file is not used by the
compilation unit.
Add header file for the quasi-standard [1] xmalloc call.

The current approach implemented in mx_util is to wait and retry on
ENOMEM malloc failure. However, this overhead doesn't seem to be
justified, because it is difficult to imagine a case, where a malloc
would fail with ENOMEM at one time and a retry would succeed.

[1] https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html
Add a utility module which can store a set of keywords. The set can be
created and updated from a string and can be serialized into a string.

The canonical string representation produced by this utilits is the space
separated list of the sorted keywords in lexical order.

Input strings used to create or update a keyword set contain keywords
separated by whitespace. The keywords may be prefxied with "+" and "-".
For updates, first all unprefixed keywords are processes to create the
initial set, than updates are applied from the prefixed keywords.

An empty string used for updates is considered "no change", not
"set to empty set".

Usage example:

    struct keywordset *kws = keywordset_new("xx yy")
    keywordset_update(kws, "-yy +zz")  // remove yy, add zz
    keywordset_update(kws, "aa bb")    // set to aa, bb
    if (keywordset_ismember(kws,"bb")) ... // true
    char *s = keywordset_get(kws):   // s now "aa bb"
    free(s);                         // caller must free()
    keywordset_purge(kws)            // set nowto empty.
    keywordset_free(kws);
Add list of blacklisted and whitelisted servers to group. The string is
supposed to be canonical (lexical sorted, space separated) as produced
by keywordset_get(), so that groups with equal sets can be found by sql
string compare.
Add list of blacklisted and whitelisted servers to group. The string is
supposed to be canonical (lexical sorted, space separated) as produced
by keywordset_get(), so that groups with equal sets can be found by sql
string compare.
Add a new options so that specific mxqd servers can be excluded from starting
jobs for this group.

    mxqsub --whitelist "acedia avaritia" sleep 10   // start only on these
    mxqsub --blacklist dontpanic sleep 10 // start on any node but this one

Blacklist has priority, so

    mxqsub --white "kronos, uselessbox" --black kronos

would not start on kronos. The lists of blacklisted and whitelisted
servers can be modified with mxqset.
Add a new command which can be used to modify an existing group.

Examples:

    mxqset group 123 --closed
    mxqset group 123 --open
    mxqset group 123 --blacklist "dontpanic"          # replace
    mxqset group 123 --whitelist "+uselessbox +gula"  # add
    mxqset group 123 --blacklist -dontpanic           # remove
    mxqset group 123 --whitelist ""                   # clear

The flags open and closed can be set from mxqadmin as well
(`mxqadmin --close=123`) , but the synopsis, in which the options take
the groupid as a value is difficult to expand to new options, which take a
value.
Check, whether this server is qualified to start jobs from a group.

Lazy-evaluate qualification criteria defined in the group and cache the result.

The qualification criteria need to be reevaluated  when the active groups
were reloaded, because they may be changed by the user in existing
groups.

For now, the only qualification criteria are the groups blacklist and
whitelist. If a group has a whitelist, the short or long hostname of the
mxqd server needs to be on that list, otherwise the server is not
qualified for the group.

If the servers name is on the blacklist of the group, the server is not
qualified for the group.

Don't start jobs we are not qualified for.

This can later be expanded to additional criteria (e.g. hostconfig or
processor flags).
@donald donald changed the title Add whitelist servers Add --blacklist/--whitelist to mxqsub, add mxset Apr 15, 2020
@donald donald mentioned this pull request Apr 15, 2020
@donald
Copy link
Contributor Author

donald commented Apr 15, 2020

closed for #83

@donald donald closed this Apr 15, 2020
Sign in to join this conversation on GitHub.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants